package de.hpi.generator.generator.storages;

/**
 * saves value attributes (value, value index, value count)
 * @author Michael Wolowyk
 */
public class ValueSeriaInfo {

    private int aValue = -1;
    /**
     * cardinality of the value
     */
    private int aValueCount = -1;
    /**
     * value index in the Unique.bin
     */
    private int aUniqueValueIndex = -1;
    public final static int NUMBER_OF_ATTRIBUTES = 3;

    public ValueSeriaInfo(int aValue, int aValueCount) {
        this.aValue = aValue;
        this.aValueCount = aValueCount;
    }

    public int getValue() {
        return aValue;
    }

    public int getValueCount() {
        return aValueCount;
    }

    public void setValueCount(int aNewValueCount) {
        aValueCount = aNewValueCount;
    }

    public int getUniqueValueIndex() {
        return aUniqueValueIndex;
    }

    public void setUniqueValueIndex(int aNewUniqueValueIndex) {
        this.aUniqueValueIndex = aNewUniqueValueIndex;
    }

    public String toString() {
        return "\tvalue: " + aValue + "\tvalueCount:" + aValueCount + "\tvalueIndex: " + aUniqueValueIndex;
    }

    @Override
    public boolean equals(Object aObject) {
        if (aObject instanceof ValueSeriaInfo) {
            ValueSeriaInfo aValueSeriaInfo = (ValueSeriaInfo) aObject;
            if (aValueSeriaInfo.getValue() == this.aValue && aValueSeriaInfo.getUniqueValueIndex() == this.aUniqueValueIndex) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + this.aValue;
        hash = 59 * hash + this.aUniqueValueIndex;
        return hash;
    }
}
